#pragma once

#include "SComboBox.h"
#include "STreeComboWidget.h"
#include "widgets.h"

class S_WIDGETS_EXPORT STreeComboBox : public SComboBox {
  Q_OBJECT
 public:
  STreeComboBox(QWidget* parent = nullptr, bool bShowInvert = true,
                QString strColor = "BackNormal",
                QString strBorderColor = "Highlight", int itemHeight = 24,
                int dropHeight = 200);
  ~STreeComboBox();

 public:
  void clearSelect();
  void setTreeData(STreeData& treeData);
  void setTreeEnable(bool enable);
  void setDefaultString(const QString& strDefault);
  void setDropFixedWidth(int width);
  const QStringList& getSelectItemData();

 Q_SIGNALS:
  void itemSelectChanged();

 protected Q_SLOTS:
  void onTreeItemSelectChanged();

 protected:
  virtual void paintEvent(QPaintEvent* e) override;

 protected:
  bool getSelectItemText(QStringList& lstText);

 protected:
  QString m_strText;
  QString m_strDefault;
  bool m_bShowInvert;
  STreeComboWidget* m_pTree;
};